import fetch from 'utils/fetch';
/**
 * 学校管理
 */
//查询经销商列表
export function findAgentsByPage(page,rows,provinceId,cityId,areaId,account,userName,phone,status) {
    const data = {
        provinceId,
        cityId,
        areaId,
        account,
        userName,
        phone,
        status
    };
    return fetch({
        url: '/agent/findAgentsByPage/'+page+'/'+rows,
        method: 'post',
        data
    });
  }
//添加经销商
export function saveAgent(userName,account,password,phone,orgRegionMaps,schoolNum,agentMoney) {
    const data = {
        userName,
        account,
        password,
        phone,
        orgRegionMaps,
        schoolNum,
        agentMoney
    };
    return fetch({
        url: '/agent/saveAgent',
        method: 'post',
        data
    });
  }
//查询经销商代理区域
export function findAgentAreaByOrgUserId(orgUserId) {
    const data = {
 
    };
    return fetch({
        url: '/agent/findAgentAreaByOrgUserId/'+orgUserId,
        method: 'post',
        data
    });
  }
//删除经销商代理区域
export function removeAgentAreaById(areaId) {
    const data = {
        
    };
    return fetch({
        url: '/agent/removeAgentAreaById/'+areaId,
        method: 'post',
        data
    });
}
//初始化密码
export function resetPassword(pId) {
    const data = {       
    };
    return fetch({
        url: '/agent/resetPassword/'+pId,
        method: 'post',
        data
    });
}
 
 
//修改经销商信息
export function modifyAgent(id,userName,account,phone,orgRegionMaps,schoolNum,agentMoney,pId) {
    const data = {
        id,
        userName,
        account,
        phone,
        orgRegionMaps,
        schoolNum,
        agentMoney,
        pId
    };
    return fetch({
        url: '/agent/modifyAgent',
        method: 'post',
        data
    });
}
//禁用/启用账号
export function updateAgent(status,id) {
    const data = {
        id,
        status
    };
    return fetch({
        url: '/agent/updateAgent',
        method: 'post',
        data
    });
}
//添加经销商区域
export function saveAgentArea(id,userName,account,phone,orgRegionMaps,delOrgRegionMaps,schoolNum,agentMoney,pId) {
    const data = {
        id,
        userName,
        account,
        phone,
        orgRegionMaps,
        delOrgRegionMaps,
        schoolNum,
        agentMoney,
        pId
    };
    return fetch({
        url: '/agent/saveAgentArea',
        method: 'post',
        data
    });
}
//登录名重复判断
export function findAccountIsExist(account) {
    const data = {
        account
    };
    return fetch({
      url: '/agent/findAccountIsExist',
      method: 'post',
      data
    });
  }
 
  //获取学校数量
export function getOrgUserSchoolMapById(pId) {
    return fetch({
      url: `/agent/getOrgUserSchoolMapById/${pId}`,
      method: 'post',
    });
  }
